﻿#pragma once

#include "CoreMinimal.h"
#include "SElementUISlate.h"

class ELEMENTUISLATE_API SSwitch : public SElementUISlate
{
public:

	SLATE_BEGIN_ARGS(SSwitch): _SwitchPosition(EHorizontalAlignment::HAlign_Left) {}
		SLATE_ATTRIBUTE(EHorizontalAlignment, SwitchPosition)
		SLATE_ATTRIBUTE(float, IconWidth)
		SLATE_ATTRIBUTE(const FSlateBrush*, BorderImage)
		SLATE_ATTRIBUTE(FText, LeftLabelText)
		SLATE_ATTRIBUTE(FSlateFontInfo, LeftLabelFont)
		SLATE_ATTRIBUTE(FText, RightLabelText)
		SLATE_ATTRIBUTE(FSlateFontInfo, RightLabelFont)

	SLATE_END_ARGS()
	SSwitch();
	void Construct(const FArguments& InArgs);
public:
	void SetSwitchPosition(EHorizontalAlignment value);
	void SetIconWidth(float value);
	void SetBorderImage(FSlateBrush* value);
	void SetLeftLabelText(FText value);
	void SetLeftLabelFont(FSlateFontInfo value);
	void SetRightLabelText(FText value);
	void SetRightLabelFont(FSlateFontInfo value);
	

private:
	TAttribute<FText> LeftLabelText;
	FSlateFontInfo LeftLabelFont;
	TAttribute<FText> RightLabelText;
	FSlateFontInfo RightLabelFont;
	EHorizontalAlignment SwitchPosition;
	float IconWidth;
	const FSlateBrush* BorderImage;
private:
	TSharedPtr<SBox> OuterBox;
	TSharedPtr<SHorizontalBox> HorizontalLayout;
	TSharedPtr<SBox> LeftLabelBox;
	TSharedPtr<STextBlock> LeftLabel;
	TSharedPtr<SBox> SwitchBox;
	TSharedPtr<SButton> SwitchButton;
	TSharedPtr<SBorder> SwitchBorder;
	TSharedPtr<SBox> SwitchSize;
	TSharedPtr<SBox> RightLabelBox;
	TSharedPtr<STextBlock> RightLabel;
};
